//index.js
//获取应用实例
const app = getApp();
//const that = this;
Page({
  data: {

    slogan: '点评企业，创造价值', // 标语
    hint: '输入感兴趣的公司、领域，开始您的点评之旅……', // 提示
    searchHint: '搜索企业名称、所在行业等信息', // 搜索栏提示
    title: '——焦点企业——',
    /**
     * tabBar
     */
    tabBar: null,

    /*行业分类*/
    catalogue: [{
      thumb: '../../img/catalogue/1.png',
      desc: '互联网',
      category: '../search/search?category=互联网'
    }, {
      thumb: '../../img/catalogue/2.png',
      desc: '医疗',
      category: '../search/search?category=医疗'
    }, {
      thumb: '../../img/catalogue/3.png',
      desc: '金融',
      category: '../search/search?category=金融'
    }, {
      thumb: '../../img/catalogue/4.png',
      desc: '教育',
      category: '../search/search?category=教育'
    }, {
      thumb: '../../img/catalogue/5.png',
      desc: '更多',
      category: '../catalogue/catalogue'
    }],
    /*企业panel*/
    hotCompanies: [],
  },

  onLoad: function () {
    //console.log(app.globalData.Token);
    var that = this;
    app.editTabBar();
    // 获取焦点企业信息
    that.getHotCompanyInfo();

  },
  /**
   * 获取焦点企业信息
   */

  getHotCompanyInfo: function () {
    var that = this;
    wx.request({
      url: app.globalData.server + '/user/company/hot/',
      method: 'GET',
      data: {},
      header: {
        'content-type': 'application/x-www-form-urlencoded', // 默认值
        'Authorization': 'Bearer ' + app.globalData.token,
        'x-wxapp-signature': null,
        'x-wxapp-timestamp': app.getTimestamp(),
        'x-wxapp-nonce': app.getRandom()
      },
      success: function (res) {
        console.log(res.data.data);
        that.setData({
          hotCompanies: res.data.data,
        })
      }
    });
  }

})
